package com.estate.common.constant;

import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Component
public class RoleCategory {
    // 买家列表
    private List<String> buyers;

    // 租客列表
    private List<String> tenants;

    // 竞拍者列表
    private List<String> bidders;

    // 其他角色列表
    private List<String> otherRoles;

    public RoleCategory() {
        initializeRoles();
    }

    private void initializeRoles() {
        // 买家列表
        buyers = Arrays.asList(
                "Buyer", "Purchaser", "Web Enquiry", "Past Buyer", "Past Purchaser",
                "Prospective Buyer", "Inactive Buyer", "MBC Buyer", "MBC Past Purchaser"
        );

        // 租客列表
        tenants = Arrays.asList(
                "Tenant", "Past Tenant", "Prospective Tenant", "Prospective Vendor",
                "Competitors Tenants"
        );

        // 竞拍者列表
        bidders = Arrays.asList(
                "Bidder"
        );

        // 其他角色列表（不属于上述分类的）
        otherRoles = Arrays.asList(
                "Vendor", "Owner", "Landlord", "Solicitor", "Past Vendor",
                "Prospective Landlord", "Enquiry", "Past Landlord", "Investor",
                "Import", "Developer", "MB Withdrawn Vendor", "Relocation Agent",
                "Auto Alerts Test", "Past Owner", "MB Landlord", "MBC Prospective Vendor",
                "MBC Vendor", "MBC Past Vendor", "MBC Withdrawn Vendor", "Supplier",
                "Business", "Conjunctional Agent", "Mortgage Broker"
        );
    }

    // Getter方法
    public List<String> getBuyers() {
        return buyers;
    }

    public List<String> getTenants() {
        return tenants;
    }

    public List<String> getBidders() {
        return bidders;
    }

    public List<String> getOtherRoles() {
        return otherRoles;
    }

    // 判断方法
    public boolean isBuyer(String role) {
        return buyers.contains(role);
    }

    public boolean isTenant(String role) {
        return tenants.contains(role);
    }

    public boolean isBidder(String role) {
        return bidders.contains(role);
    }

    // 打印所有分类信息
    public void printAllCategories() {
        System.out.println("=== 买家列表 ===");
        buyers.forEach(System.out::println);

        System.out.println("\n=== 租客列表 ===");
        tenants.forEach(System.out::println);

        System.out.println("\n=== 竞拍者列表 ===");
        bidders.forEach(System.out::println);

        System.out.println("\n=== 其他角色列表 ===");
        otherRoles.forEach(System.out::println);
    }

    public static void main(String[] args) {
        RoleCategory roleCategory = new RoleCategory();
        roleCategory.printAllCategories();
    }
}
